package com.whmskj.xjlhsc.mobie.personnelFile.mapper;

import com.whmskj.xjlhsc.mobie.personnelFile.entity.ApprovalRule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 审批规则配置Mapper
 * @author System
 * @date 2025-01-15
 */
@Mapper
public interface ApprovalRuleMapper {
    
    /**
     * 根据条件查找匹配的审批规则
     * @param leaveType 请假类型
     * @param dept 部门
     * @param position 岗位
     * @param leaveDays 请假天数
     * @return 匹配的审批规则
     */
    ApprovalRule findMatchingRule(@Param("leaveType") String leaveType,
                                 @Param("dept") String dept,
                                 @Param("position") String position,
                                 @Param("leaveDays") BigDecimal leaveDays);
    
    /**
     * 查询所有启用的审批规则
     */
    List<ApprovalRule> selectAllEnabled();
    
    /**
     * 插入审批规则
     */
    int insert(ApprovalRule rule);
    
    /**
     * 更新审批规则
     */
    int updateById(ApprovalRule rule);
    
    /**
     * 根据ID删除审批规则
     */
    int deleteById(@Param("ruleId") Integer ruleId);
}
